<?php

namespace app\api\validate;

use think\Validate;

class Order extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'order_id'  =>  'require|integer|gt:0',
        'content'  =>  'require',
        'goods_rank'  =>  'require|integer|in:1,2,3,4,5',
        'refund_reason'  =>  'require',
        'refund_content'  =>  'require',
        'order_goods_id'  =>  'require',
        'order_no' => 'require',
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'order_id.require'  =>  '請求參數不能為空',
        'order_id.integer'  =>   '請求參數類型錯誤',
        'order_id.gt'  =>   '請求參數類型錯誤',
        'content.require'  =>  '請輸入評論內容',
        'goods_rank.require'  =>  '請給評分',
        'goods_rank.integer'  =>   '評分參數類型錯誤',
        'goods_rank.gt'  =>   '評分參數類型錯誤',
        'goods_rank.in'  =>   '評分參數類型錯誤',
        'order_goods_id.require'  =>  '請選擇商品',
        'refund_reason.require'  =>  '請選擇退款原因',
        'refund_content.require'  =>  '請輸入補充描述和憑證',
        'order_no.require'  =>  '請選擇訂單',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'getorderinfo'  => ['order_id'],
        'publishcomment'  => ['order_id','order_goods_id','goods_rank','content'],
        'refund'  => ['order_id','refund_reason','refund_content'],
        'regetcode' => ['order_no'],
    ];
    
}
